package com.bailian.spring.ioc.prototype_lifecycle;

import com.bailian.spring.ioc.prototype_lifecycle.bean.Pen;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author gaoxu
 * date: Created on 2021/11/1 下午4:09
 */

@Configuration
public class PrototypeLifecycleConfiguration {

    @Bean(initMethod = "open", destroyMethod = "close")
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public Pen pen() {
        return new Pen();
    }
}
